package com.ruoyi.wjq.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wjq.mapper.FavoriteQuestionMapper;
import com.ruoyi.wjq.domain.FavoriteQuestion;
import com.ruoyi.wjq.service.IFavoriteQuestionService;

/**
 * 题目收藏Service业务层处理
 * 
 * @author wjq
 * @date 2025-08-13
 */
@Service
public class FavoriteQuestionServiceImpl implements IFavoriteQuestionService 
{
    @Autowired
    private FavoriteQuestionMapper favoriteQuestionMapper;

    /**
     * 查询题目收藏
     * 
     * @param id 题目收藏主键
     * @return 题目收藏
     */
    @Override
    public FavoriteQuestion selectFavoriteQuestionById(Long id)
    {
        return favoriteQuestionMapper.selectFavoriteQuestionById(id);
    }

    /**
     * 查询题目收藏列表
     * 
     * @param favoriteQuestion 题目收藏
     * @return 题目收藏
     */
    @Override
    public List<FavoriteQuestion> selectFavoriteQuestionList(FavoriteQuestion favoriteQuestion)
    {
        return favoriteQuestionMapper.selectFavoriteQuestionList(favoriteQuestion);
    }


    @Override
    public List<FavoriteQuestion> selectFavoriteQuestionList1(FavoriteQuestion favoriteQuestion)
    {
        return favoriteQuestionMapper.selectFavoriteQuestionList1(favoriteQuestion);
    }

    /**
     * 新增题目收藏
     * 
     * @param favoriteQuestion 题目收藏
     * @return 结果
     */
    @Override
    public int insertFavoriteQuestion(FavoriteQuestion favoriteQuestion)
    {
        favoriteQuestion.setCreateTime(DateUtils.getNowDate());
        return favoriteQuestionMapper.insertFavoriteQuestion(favoriteQuestion);
    }

    /**
     * 修改题目收藏
     * 
     * @param favoriteQuestion 题目收藏
     * @return 结果
     */
    @Override
    public int updateFavoriteQuestion(FavoriteQuestion favoriteQuestion)
    {
        return favoriteQuestionMapper.updateFavoriteQuestion(favoriteQuestion);
    }

    /**
     * 批量删除题目收藏
     * 
     * @param ids 需要删除的题目收藏主键
     * @return 结果
     */
    @Override
    public int deleteFavoriteQuestionByIds(Long[] ids)
    {
        return favoriteQuestionMapper.deleteFavoriteQuestionByIds(ids);
    }

    /**
     * 删除题目收藏信息
     * 
     * @param id 题目收藏主键
     * @return 结果
     */
    @Override
    public int deleteFavoriteQuestionById(Long id)
    {
        return favoriteQuestionMapper.deleteFavoriteQuestionById(id);
    }
}
